<?php
namespace PHPSpring\Core;

class ProxyFactory {

  private static array $proxyInsMap = array();

  public static function getProxy ($target) {
    $targetClassName = Proxy::getClassName($target);
    if (isset(self::$proxyInsMap[$targetClassName])) {
      return self::$proxyInsMap[$targetClassName];
    }
    $proxy = Proxy::getProxy($target);
    $ins = new $proxy($target);
    self::$proxyInsMap[$targetClassName] = $ins;
    return $ins;
  }

}
